

public class PlainTextSalesFormatter implements SalesFormatter{

	private static PlainTextSalesFormatter singletonInstance = null;
    private PlainTextSalesFormatter() { }
    public static PlainTextSalesFormatter getSingletonInstance() {
        if (singletonInstance == null) {
            singletonInstance = new PlainTextSalesFormatter();
        }
        return singletonInstance;
    }
	
	public String formatSales(Sales sales) {
		int numOrders =sales.getNumberOfOrders();

		if (numOrders != 0) {
			int orderNumber = 1;
			for (Order  order : sales) {

				System.out.println("------------------------");
				System.out.println("Order " + orderNumber++);

				for (OrderItem  orderItem : order) {
					System.out.println("   " + orderItem.toString());
				}
				System.out.println("   Total: " +
					order.getTotalCost());
			}
		} else {
			System.out.println("There are no sales");
		}
		String str ="";
		return str;
		
	}

}
